package query_understanding.common.nlp_toolkit;


import edu.stanford.nlp.ling.IndexedWord;
import edu.stanford.nlp.semgraph.SemanticGraphEdge;

/**
 * Created by julianzliu on 4/26/2017.
 */
public class RelationEdge {

    public enum ParserRelationType {
        BASE, VERB, NOUN, PREP
    }


    public static class BaseRelation {
        public ParserRelationType relationType;

        public IndexedWord linkPoint;
        public IndexedWord relation;
        public IndexedWord otherSide;

        public SemanticGraphEdge inEdge;
        public SemanticGraphEdge outEdge;

        public BaseRelation(){
            this.relationType = ParserRelationType.BASE;
        }

        public boolean isHaveObject(){
            if(this.relation == this.otherSide)
                return false;
            return true;
        }

        @Override
        public String toString(){
            String  str = "";
            str += linkPoint + " [" + inEdge + "] "  + relation + " ["  + outEdge + "] " + otherSide;
            return str;
        }
    }


    public static class VerbsRelation extends BaseRelation {
        //public IndexedWord subj;
        //public IndexedWord obj;
        //public IndexedWord verb;

        public VerbsRelation(){
            this.relationType = ParserRelationType.VERB;
        }
    }


    public static class NounsRelation extends BaseRelation {
        //public IndexedWord subj;
        //public IndexedWord attr;
        public NounsRelation(){
            this.relationType = ParserRelationType.NOUN;
        }
    }

    /*
    介词
     */
    public static class PrepsRelation extends BaseRelation {

    }
}
